package ioc

import (
	"gitee.com/tools/internal/service"
	"gitee.com/tools/internal/service/IP/Mi"
	"gitee.com/tools/internal/service/document/aliyun"
	"gitee.com/tools/internal/web"
)

func InitTools() *web.Tools {
	svc := service.NewPort()
	return web.NewTools(svc)
}

func InitFormat() *web.Format {
	doc := aliyun.NewAliyunConvert()
	svc := service.NewFormatService(doc)
	return web.NewFormat(svc)
}

func InitEncrypt() *web.Encrypt {
	svc := service.NewEncryptTools()
	return web.NewEncrypt(svc)
}

func InitSelect() *web.SelectHandler {
	//key, ok := os.LookupEnv("IP_YUN_KEY")
	//if !ok {
	//	log.Println("未发现key")
	//	return nil
	//}
	//ipyun := IPYUN.NewIPYunSvc(key)
	miIP := Mi.NewMiService()
	svc := service.NewSelectSvc(miIP)
	return web.NewSelectHandler(svc)
}
